using UniversalAdmin.Application.Dtos;
using UniversalAdmin.Application.Dtos.ArticleCategory;

namespace UniversalAdmin.Application.Services.Interfaces;

/// <summary>
/// 文章分类服务接口
/// </summary>
public interface IArticleCategoryService
{
    /// <summary>
    /// 根据ID获取分类
    /// </summary>
    /// <param name="id">分类ID</param>
    /// <returns>分类信息，不存在返回null</returns>
    Task<ArticleCategoryDto?> GetByIdAsync(Guid id);

    /// <summary>
    /// 分页获取分类列表
    /// </summary>
    /// <param name="request">分页请求参数</param>
    /// <returns>分页结果</returns>
    Task<PagedResult<ArticleCategoryDto>> GetPagedAsync(PageRequestDto request);

    /// <summary>
    /// 获取所有分类
    /// </summary>
    /// <returns>分类列表</returns>
    Task<List<ArticleCategoryDto>> GetAllAsync();

    /// <summary>
    /// 获取分类树形结构
    /// </summary>
    /// <returns>树形分类列表</returns>
    Task<List<ArticleCategoryDto>> GetTreeAsync();

    /// <summary>
    /// 获取指定父分类下的子分类
    /// </summary>
    /// <param name="parentId">父分类ID，null表示获取根分类</param>
    /// <returns>子分类列表</returns>
    Task<List<ArticleCategoryDto>> GetChildrenAsync(Guid? parentId);

    /// <summary>
    /// 创建分类
    /// </summary>
    /// <param name="createDto">创建分类DTO</param>
    /// <returns>创建后的分类信息</returns>
    Task<ArticleCategoryDto> CreateAsync(CreateArticleCategoryDto createDto);

    /// <summary>
    /// 更新分类
    /// </summary>
    /// <param name="updateDto">更新分类DTO</param>
    /// <returns>更新后的分类信息</returns>
    Task<ArticleCategoryDto> UpdateAsync(UpdateArticleCategoryDto updateDto);

    /// <summary>
    /// 删除分类 (软删除)
    /// </summary>
    /// <param name="id">分类ID</param>
    /// <returns></returns>
    Task DeleteAsync(Guid id);

    /// <summary>
    /// 检查分类是否有子分类
    /// </summary>
    /// <param name="id">分类ID</param>
    /// <returns>是否有子分类</returns>
    Task<bool> HasChildrenAsync(Guid id);

    /// <summary>
    /// 检查分类是否有文章
    /// </summary>
    /// <param name="id">分类ID</param>
    /// <returns>是否有文章</returns>
    Task<bool> HasArticlesAsync(Guid id);
}
